package stackoverflow.domain.question;

import org.apache.commons.lang.Validate;

import stackoverflow.domain.shared.IdGenerator;
import stackoverflow.domain.user.User;

public class Answer extends Post {

	private String id = IdGenerator.createId();
	private Question question;

	public Answer(){}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Question getQuestion() {
		return question;
	}

	public void setQuestion(Question question) {
		this.question = question;
	}

	public Answer(User postedBy, String text) {
		Validate.noNullElements(new Object[] { postedBy, text },
				"Posting user and answer text must all be non null.");
		Validate.notEmpty(text, "AnswerText cannot be empty");
		this.text = text;
		this.postedBy = postedBy;
	}
}
